@echo off
chcp 65001 >nul
echo ========================================
echo    ITS Local Development Mode
echo ========================================
echo.
echo Starting local development environment...

cd /d "%~dp0"

echo [1/3] Starting database only...
docker-compose up -d database

echo Waiting for database to start...
timeout /t 5 /nobreak >nul

echo [2/3] Starting backend locally...
cd ..\backend
start "ITS Backend" cmd /c "python -m uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload"

echo [3/3] Starting frontend locally...
cd ..\frontend
start "ITS Frontend" cmd /c "npm start"

echo.
cd ..\docker
echo ========================================
echo    Local development environment ready!
echo ========================================
echo.
echo Services:
echo - Database: Docker (PostgreSQL)
echo - Backend: Local Python (Hot Reload)
echo - Frontend: Local Node.js (Hot Reload)
echo.
echo Access URLs:
echo - Frontend: http://localhost:3000
echo - Backend API: http://localhost:8000/api
echo - API Docs: http://localhost:8000/docs
echo.
echo Benefits:
echo - Fastest development speed
echo - Native debugging support
echo - Direct file system access
echo - No Docker overhead
echo.
echo To stop: Close the backend and frontend terminal windows
echo          Then run: docker-compose stop database
echo.